package com.xj.onetosix;

public class User {

    String userName;
    int age;

    /**
     * 构造方法 如果你声明了一个有参数的构造方法，那么默认无参的就会被覆盖
     *
     * @param userName
     * @param age
     */
    public User(String userName, int age) {
        this.userName = userName;
        this.age = age;
    }

    public User() {
    }

    public static void main(String[] args) {
        //如果用final修饰对象，那么对象的值可以改变，但是对象的引用不能变
        final User user = new User("张三", 22);
        user.userName = "李四";
        user.age = 23;

        System.out.println(user.userName);

        User user1 = new User();
       // user=user1;

    }
}
